package service

import (
	"bzppx-codepub-server/bzppx-agent/app/utils"
	"github.com/gogf/gf/g/os/glog"
	"net/rpc"
)

const version = "0.8.4"

// RegisterServices： 全局单例
var RegisterServices = []interface{}{}

// Register： 注册服务
func Register(service interface{}) {
	RegisterServices = append(RegisterServices, service)
}

// RegisterRpc： 注册rpc
func RegisterRpc() {
	Register(&Example{})
	Register(&ServiceSystem{})
	Register(&ServiceTask{gitXParams: utils.GitXParams{}, preCommandXParams: utils.CommandXParams{}, postCommandXParams: utils.CommandXParams{}})

	for _, ser := range RegisterServices {
		glog.Debugf("注册rpc: %#v", ser)
		rpc.Register(ser)
	}
}
